{% extends "menu.html" %}
{% block content %}

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">



            </div>
            <div class="clearfix"></div>
            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>数据库功能</h2>

                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <br />
                    <style>
                      /*自己调整宽度*/
                      .tab-wraped > li ul {
                        width: 140px;
                      }
                      .tab-wraped > li ul label {
                        width: 50px!important;
                      }
                    </style>
                    <ul class="sui-nav nav-tabs tab-wraped">
                      <li class="active">
                          <a href="#index" data-toggle="tab">
                          <h3>查询联盟密码</h3></a></li>
                      <li><a href="#profile" data-toggle="tab">
                          <h3>导出指定区数据库</h3></a></li>
                      <li><a href="#gift" data-toggle="tab">
                          <h3>礼包码导出</h3></a></li>
                      <li><a href="#gift4" data-toggle="tab">
                          <h3>指定区服角色数据查询</h3></a></li>
                      <li><a href="#gift5" data-toggle="tab">
                          <h3>区服列表查询</h3></a></li>
                      <li><a href="#gift6" data-toggle="tab">
                          <h3>合服列表生成</h3></a></li>
                      <li><a href="#gift7" data-toggle="tab">
                          <h3>玩家模糊匹配</h3></a></li>
                      <li><a href="#gift8" data-toggle="tab">
                          <h3>区服活动导出</h3></a></li>

                    </ul>
                    <div class="tab-content tab-wraped">
                      <div id="index" class="tab-pane active">
                          <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="1" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num">
                                </div>
                              </div>

                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name"> 联盟名称<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="alliance_name">
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <table class="sui-table table-bordered-simple">
                          <thead>
                            <tr>
                              <th>联盟名字</th>
                                <th>等级</th>
                              <th>经验</th>
                              <th>联盟密码</th>
                            </tr>
                          </thead>
                          <tbody>
                          {% for p in result1 %}
                            <tr>
                              <td>{{ p.name }}</td>
                              <td>{{ p.level }}</td>
                              <td>{{ p.exp }}</td>
                              <td>{{ p.password }}</td>
                            </tr>
                          {% endfor %}
                          </tbody>
                        </table>
                      </div>
                      <div id="profile" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="2" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">只导出表结构<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="radio" name="data_structure">
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <p><a href="javascript:void(0);" class="sui-btn"><i class="sui-icon icon-pencil"></i>文件下载:</a><span style="color: red;font-size: 20px"><a href="{{ result2 }}">{{ result2 }}</a> </span></p>
                      </div>
                      <div id="gift" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="3" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">礼包ID<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="content_id" placeholder="多个编号使用英文逗号分开">
                                </div>
                              </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">生效时间<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" class="form-control col-md-7 col-xs-12" name="start_time" placeholder="2018-07-15 00:00:00">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">过期时间<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name"  class="form-control col-md-7 col-xs-12" name="overtime" placeholder="2018-07-15 00:00:00">
                                </div>
                              </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">指定礼包id全部导出</label>
                                <div class="col-md-6 col-sm-6 col-xs-12" style="margin-top: 5px">
                                    <input type="radio" name="check_all" id="y">是
                                    <input type="radio" name="check_all"  id="n" checked>否
                                </div>
                            </div>

                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <p><a href="javascript:void(0);" class="sui-btn"><i class="sui-icon icon-pencil"></i>文件下载:</a><span style="color: red;font-size: 20px"><a href="{{ result3 }}">{{ result3 }}</a> </span></p>
                      </div>
                      <div id="gift4" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="4" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num">
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <div id="result" style="display: none">
                              <p id="result_zone">区服{{ result4.zone }}人数统计</p>
                              <p id="result_time_data">{{ result4.time_data }}</p>
                              <p id="result_user_data">{{ result4.user_data }}</p>
                              <p id="result_diff_user">{{ result4.diff_user }}</p>
                          </div>
                          <div id="xxx1" style="width: 1100px;height:400px;"></div>
                    <script type="text/javascript">
                        // 基于准备好的dom，初始化echarts实例
                        var myChart = echarts.init(document.getElementById('xxx1'));
                        var zone_id = document.getElementById("result_zone").innerText;
                        var time_data_tmp = document.getElementById("result_time_data").innerText;
                        var user_data_tmp = document.getElementById("result_user_data").innerText;
                        var diff_user_tmp = document.getElementById("result_diff_user").innerText;
                        var time_data = time_data_tmp.split(",").reverse();
                        var user_data = user_data_tmp.split(",").reverse();
                        var diff_user = diff_user_tmp.split(",").reverse();   //字符串转换为列表，并倒序

                        // 指定图表的配置项和数据

                        var option1 = {
                            title: {
                                text: zone_id
                            },
                            tooltip: {
                                trigger: 'axis'
                            },
                            legend: {
                                data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: time_data
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: [
                                {#{#}
                                {#    name:"与上次查询异常数:",#}
                                {#    type:'line',#}
                                {#    data:diff_user#}



                                {
                                    name:zone_id,
                                    type:'line',
                                    data:user_data
                                },


                            ]
                        };

                        // 使用刚指定的配置项和数据显示图表。
                        myChart.setOption(option1);
                    </script>

                      </div>
                      <div id="gift5" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="5" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num">
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <table class="sui-table table-bordered-simple">
                              <thead>
                                <tr>
                                  <th>id</th>
                                  <th>areaid</th>
                                  <th>name</th>
                                  <th>address</th>
                                  <th>serverHttPort</th>
                                  <th>dbPort</th>
                                  <th>dbUser</th>
                                  <th>dbIp</th>
                                  <th>dbName</th>
                                  <th>logAddress</th>
                                  <th>logHTTpAddress</th>
                                  <th>allowLookIP</th>
                                </tr>
                              </thead>
                              <tbody>
                              {% for serverlist in result5 %}
                                <tr>
                                  <td>{{ serverlist.id }}</td>
                                  <td>{{ serverlist.areaid }}</td>
                                  <td>{{ serverlist.name }}</td>
                                  <td>{{ serverlist.address }}</td>
                                  <td>{{ serverlist.serverHttpPort }}</td>
                                  <td>{{ serverlist.dbPort }}</td>
                                  <td>{{ serverlist.dbUser }}</td>
                                  <td>{{ serverlist.dbIp }}</td>
                                  <td>{{ serverlist.dbName }}</td>
                                  <td>{{ serverlist.logAddress }}</td>
                                  <td>{{ serverlist.logHTTpAddress }}</td>
                                  <td>{{ serverlist.allowLookIP }}</td>
                                </tr>
                              {% endfor %}

                              </tbody>
                            </table>

                      </div>
                      <div id="gift6" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="6" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">合服区服id<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num" placeholder="多个不连续的区服英文逗号分割，连续的区服只需要写入开始和结尾英文逗号分割">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">是否连续区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    是: <input type="radio" name="zone_status" value="1" checked>
                                    否: <input type="radio" name="zone_status" value="0" >
                                </div>
                              </div>
                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <p></p>
                          <p>{{ result6 }}</p>

                      </div>
                      <div id="gift7" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="7" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="zone_num">
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">玩家名<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="player_name">
                                </div>
                              </div>

                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <p></p>
                          <table class="sui-table table-bordered-simple">
                              <thead>
                                <tr>
                                  <th>name</th>
                                  <th>serverid</th>
                                </tr>
                              </thead>
                              <tbody>
                              {% for palyer in result7 %}
                                <tr>
                                  <td>{{ palyer.name }}</td>
                                  <td>{{ palyer.serverid }}</td>
                                </tr>
                              {% endfor %}

                              </tbody>
                            </table>

                      </div>
                      <div id="gift8" class="tab-pane">
                        <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">功能<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="fun_num" value="8" readonly>
                                </div>
                              </div>
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">区服<span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="game_zone" placeholder="输入第几个区即可，只支持单个区服，如3，表示3区">
                                </div>
                              </div>



                              <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                  <button class="btn btn-primary" type="button">Cancel</button>
                                  <button class="btn btn-primary" type="reset">Reset</button>
                                  <button type="submit" class="btn btn-success">Submit</button>
                                </div>
                              </div>
                          </form>
                          <p><a href="javascript:void(0);" class="sui-btn"><i class="sui-icon icon-pencil"></i>文件下载:</a><span style="color: red;font-size: 20px"><a href="{{ result8 }}">{{ result8 }}</a> </span></p>
                      </div>


                    </div>

                  </div>
                </div>
              </div>
            </div>


          </div>
        </div>
{% endblock %}